#pragma once

#include "SDL/SDL.h"
#include "srect.h"
#include "graphics.h"
#include "graphics_constants.h"

struct ImageClip
{
	static const int DEFAULT_TRANSPARENT_INDEX = 0;
	BitMaP * image;
	SRect clip;
	void set(BitMaP * a_image, const SRect & a_clip)
	{
		image=a_image;
		clip=a_clip;
	}
	ImageClip(BitMaP * a_image, const SRect & a_clip):image(a_image),clip(a_clip){}
	ImageClip():image(0){}
	ImageClip(const ImageClip & a):image(a.image),clip(a.clip){}
	void draw(SDL_Surface * a_dest, const SPoint & a_position, const int & a_transparentColor);
	/**
	 * @param a_dest which context to draw the clip in
	 * @param a_position where in the context to draw the clip
	 * @param a_flip what VSDL_FLIP_* flags to set, determining flip
	 * @param a_pixelSize the multiplier (zoom) to draw at
	 * @param a_transparentColor which index color to not draw
	 */
	void draw(SDL_Surface * a_dest, const SPoint & a_position, 
		const int & a_flip, const int & a_pixelSize, const int & a_transparentColor);
	bool equals(const ImageClip & a_imgclip)
	{return clip.equals(a_imgclip.clip) && image == a_imgclip.image;}
};
